<?php
/**
 * @name Bootstrap
 * @author falcom520@gmail.com
 * @desc 所有在Bootstrap类中, 以_init开头的方法, 都会被Yaf调用
 */
class Bootstrap extends \Yaf\Bootstrap_Abstract {


    public function _initConfig() {
		//把配置保存起来
		$arrConfig = \Yaf\Application::app()->getConfig();
		\Yaf\Registry::set('config', $arrConfig);
	}

	public function _initPlugin(\Yaf\Dispatcher $dispatcher) {
		//注册一个插件
		$objSamplePlugin = new SamplePlugin();
		$dispatcher->registerPlugin($objSamplePlugin);
		//开启布局支持
		$dispatcher->registerPlugin(new LayoutPlugin());
	}

	public function _initRoute(\Yaf\Dispatcher $dispatcher) {
		//在这里注册自己的路由协议,默认使用简单路由
		$router = \Yaf\Dispatcher::getInstance()->getRouter();
		$router->addRoute("Krouter",new \Vendor\Krouter());
	}

	
	public function _initView(\Yaf\Dispatcher $dispatcher) {
		//在这里注册自己的view控制器，例如smarty,firekylin
	}
}
